# coding=UTF-8

import smtplib
import email.mime.multipart
import email.mime.text


def main():
    msg = email.mime.multipart.MIMEMultipart()
    msg['Form'] = 'terrydash@distnsrs.cn'
    msg['To'] = 'test-y9sl4@mail-tester.com'
    msg['subject'] = 'test'
    content = '''
         你好:
              这是一封自动发送的邮件。
              '''
    txt = email.mime.text.MIMEText(content)
    msg.attach(txt)

    smtp = smtplib.SMTP()
    # 打开调试信息
    smtp.set_debuglevel(True)
    # 连接服务器
    smtp.connect('125.222.146.161', '25')
    # 登录服务器
    # 发送邮件
    smtp.sendmail('terrydash@distnsrs.cn', 'test-y9sl4@mail-tester.com', str(msg))
    smtp.quit()


if __name__ == '__main__':
    main()
